<%@page contentType="text/html;charset=UTF-8"%>
<%@taglib prefix="pu" uri="/WEB-INF/tld/pageutil.tld" %>
<%@taglib prefix="mu" uri="/WEB-INF/tld/mallutil.tld" %>
<%@taglib prefix="pageable" uri="/WEB-INF/tld/pageable.tld" %>
<%@taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt"%>
<%@taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt-rt"%>
<%@taglib uri="/WEB-INF/tld/importTag.tld" prefix="import" %>
${pu:reqSet('nmProduct', pu:get('com.yaodian100.ec.product.entity.Product', param.nmProductId)) }
${pu:reqSet('currentDate', pu:currentDate()) }
${pu:listAdd('paramsShelfnm', param.nmProductId) }
${pu:listAdd('paramsShelfnm', currentDate) }
${pu:listAdd('paramsShelfnm', currentDate) }
${pu:reqSet('nmShelfs', pu:queryByHql('from Shelf where productId=? and startDate<=? and endDate>=?', pu:arrayGet('paramsShelfnm'), null)) }
${pu:reqSet('product', pu:get('com.yaodian100.ec.product.entity.Product', param.productId)) }
${pu:listAdd('paramsShelf', param.productId) }
${pu:listAdd('paramsShelf', currentDate) }
${pu:listAdd('paramsShelf', currentDate) }
${pu:reqSet('shelfs', pu:queryByHql('from Shelf where productId=? and startDate<=? and endDate>=?', pu:arrayGet('paramsShelf'), null)) }

<c-rt:set var="parasAddOnShelf" value="${null}"/> 
        	<c-rt:set var="paramsAddOnShelf" value="${pu:addToList('parasAddOnShelf', product.productId)}"/>
        	<c-rt:set var="paramsAddOnShelf" value="${pu:addToList('parasAddOnShelf', currentDate)}"/>
        	<c-rt:set var="paramsAddOnShelf" value="${pu:addToList('parasAddOnShelf', currentDate)}"/>
        	<c-rt:set var="addOnShelfs" value="${pu:queryByHql('from Shelf where productId=? and startDate<=? and endDate>=?', paramsAddOnShelf, null)}"/>
        	<c-rt:forEach items="${product.specifications}" var="spec">
        		<c-rt:set var="nmClassName" value="pdnmpinnerboxbg-out"/>
            	<c-rt:set var="parasSpecInventory" value="${null}"/>
				<c-rt:set var="paramsSpecInventory" value="${pu:addToList('parasSpecInventory', spec.specificationId)}"/>
				<c-rt:set var="specInventorys" value="${pu:queryByHql('from SpecificationInventory where specId=?', paramsSpecInventory, null)}"/>
				${pu:listAdd('nmSpecInventorys', specInventorys[0].inventory) }
				<c-rt:if test="${specInventorys[0].inventory>0}">
					<c-rt:set var="hasInventory" value="true"/>
					<c-rt:set var="nmClassName" value="pdnmpinnerboxbg"/>
				</c-rt:if>
			</c-rt:forEach>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-CN" lang="zh-CN"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<meta http-equiv="Content-Language" content="zh-CN" /> 
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> 
<link rel="stylesheet" href="/css/yaodian100_pages.css" type="text/css" media="screen" /> 
<link rel="stylesheet" href="/css/pdpagese.css" type="text/css" media="screen" /> 
<script type="text/javascript" charset="UTF-8" src="/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" charset="UTF-8" src="/js/jquery-ui-1.7.2.custom.min.js"></script>
<script type="text/javascript" charset="UTF-8" src="/js/pageable.js"></script>
<script>
$(function(){
	$('.msg').hide();
});
function selectProduct(index, specId){
	if(specId!=''){
		window.opener.selectNm(index, specId);
		window.close();
	}else{
		//alertDialog('讯息', '请选择属性');
		$('.msg').show();
	}
}
</script>

</head> 
<body> 

<div class="pd-mainbox"> 
  <p>&nbsp;</p> 
  <div class="pd-photoboxnbg"> 
    <div class="pimage"><img src="/PImg/${pu:substring(product.productId, 0, 4)}/${product.productId }/${product.productId }_m250.jpg" onError="this.src='/PImg/blank_250.gif'" alt="" width="250" height="250" /></div> 
  </div> 
  <div class="pd-infobox"> 
    <div class="infoboxheader"> 
      <p><strong><c-rt:if test="${!empty shelfs[0].promoteName}">${shelfs[0].promoteName}</c-rt:if></strong></p> 
      <h1>${product.productName }</h1> 
    </div> 
    <div class="infocontent"> 
      ${pu:reqSet('brief',mu:productBrief(param.productId)) }
          <c-rt:if test="${!empty brief}">
           	${brief }
          </c-rt:if>
          <c-rt:if test="${empty brief}">
          	<br/><br/>
          </c-rt:if> 
    </div> 
    <div class="infocontent-type"> 
            <p>商品重量：
			<c-rt:if test="${product.productWeight>0}">
            <fmt-rt:formatNumber value="${(product.productWeight+0.001)/1000 }"  pattern="#,#0.00#"/>
            </c-rt:if>
            <c-rt:if test="${product.productWeight<=0}">
            0
            </c-rt:if>
            KG (<a href="/help/6_deliveryfee.html" target="_blank">重量与运费说明</a>)</p> 
    </div> 
    <div class="pd-price">特惠价：<b>任选<em> ${nmProduct.pickupQty }</em>件<em><c-rt:if test="${!empty nmShelfs[0].shelfPrice}">${pu:currency(nmShelfs[0].shelfPrice) }</c-rt:if></em></b></div> 
    <div class="select-bar"> 
    <%--<c-rt:if test="${hasInventory=='true'}">--%>
            <div><strong>请选择：</strong> 
              <select name="specNm" id="specNm">
                      	<option value="">选择商品属性</option>
                      	<c-rt:forEach items="${product.specifications}" var="spec" varStatus="status">
                      	<c-rt:if test="${nmSpecInventorys[status.index]>0}">
                      	<option value="${spec.specificationId }">${spec.specificationName}</option>
                      	</c-rt:if>
                      	<c-rt:if test="${nmSpecInventorys[status.index]<=0}">
                      	<option value="${spec.specificationId }"  disabled="disabled">${spec.specificationName}--已售完</option>
                      	</c-rt:if>
                      	</c-rt:forEach>
                      	</select>
                      	<span class="msg rn">请选择商品属性</span>
            </div> 
    <%--</c-rt:if>
    <c-rt:if test="${hasInventory!='true'}">
    <div><strong>补货中</strong></div>
    </c-rt:if>
    --%>
      </div> 
    <div class="bt-box"> 
    <c-rt:if test="${hasInventory==true}">
    <a href="javascript:selectProduct('${param.index }', $('#specNm').attr('value'))"><span class="bt-want"></span></a>
    </c-rt:if>
    <c-rt:if test="${hasInventory!=true}">
  <div class="none-buy" title="此商品已售完，正在补货中!" ><span>已售完补货中</span></div>
  </c-rt:if>
     </div> 
  </div> 
  <div class="tab-box"> 
    <ul class="pdtab"> 
          <li><a href="pdpage_01.html" class="pdtab-f">商品信息</a></li> 
        </ul> 
   <import:wrap enableCache="false" url="/WEB-INF/jsp/product/productInfo.jsp" appendParameter="productId"/> 
   </div> 
<div class="bt-bottom2"> 
  <div class="bt-box"> 
  <c-rt:if test="${hasInventory==true}">
  <a href="javascript:selectProduct('${param.index }', $('#specNm').attr('value'))"><span class="bt-want"></span></a>
  </c-rt:if>
  <c-rt:if test="${hasInventory!=true}">
  <div class="none-buy" title="此商品已售完，正在补货中!" ><span>已售完补货中</span></div>
  </c-rt:if>
   </div> 
</div> 
</div>
<div id="dialog"></div>
</body> 
</html> 